
import os,sys,cv2
import tensorflow as tf
from keras import backend as K

sys.path.append("../")

from yolo_wrapper import Yolo

def case1():
    model_yolo = Yolo("./config_eval.json")
    image = cv2.imread("../0.jpg")
    model_yolo.predict(image, show_im=False)
    model_yolo.predict(image, show_im=False)
    model_yolo.predict(image, show_im=False)
    model_yolo.predict(image, show_im=False)
    model_yolo.predict(image, show_im=True)


if __name__ == '__main__':
    GPU = False
    CPU = True
    num_cores = 3

    if GPU:
     num_GPU = 1
     num_CPU = 1
    if CPU:
     num_CPU = 1
     num_GPU = 0

    config = tf.ConfigProto(intra_op_parallelism_threads=num_cores, \
                         inter_op_parallelism_threads=num_cores, allow_soft_placement=True, \
                         device_count={'CPU': num_CPU, 'GPU': num_GPU})
    session = tf.Session(config=config)
    K.set_session(session)
    case1()